﻿@model Forest.Cat.Web.Models.Catalog.JobListModel
@using Forest.Cat.Web.Extensions;
@using Forest.Web.Framework;
@using Forest.Cat.Domain.Shared;
@{
    ViewBag.Title = "职位搜索";
    Layout = "~/Views/Shared/_Root.cshtml";
}
<script type="text/javascript">
    $(document).ready(function () {
        $('#orderByReposted').bind('click', function () {
            window.location.href = '@(Url.Action("SearchJobList", "Catalog", new { jobTitle = ViewBag.JobTitle, companyName = ViewBag.CompanyName, lovCondition = ViewBag.LovCondition, isAdvSearch = ViewBag.IsAdvSearch }) + "&orderMode=" + JobListOrderMode.Reposted.ToString())';
            return false;
        });

        $('#orderByStartDate').bind('change', function () {
            var orderCondition = $(this).val();
            window.location.href = '@(Url.Action("SearchJobList", "Catalog", new { jobTitle = ViewBag.JobTitle, companyName = ViewBag.CompanyName, lovCondition = ViewBag.LovCondition, isAdvSearch = ViewBag.IsAdvSearch }) + "&orderMode=")' + orderCondition;
        });
    });
</script>
<div class="main_result">
    全部结果
    @Html.Raw(!String.IsNullOrWhiteSpace(ViewBag.JobCategory) ? " > " + ViewBag.JobCategory : String.Empty)
    @Html.Raw(!String.IsNullOrWhiteSpace(ViewBag.KeyWord) ? " > 搜索\"" + ViewBag.KeyWord + "\"" : String.Empty)
</div>
<div class="main_content">
    <div class="main_content_left">
        @{Html.RenderAction("JobCategoryInfo", new {
              jobTitle = Model.JobTitle,
              companyName = Model.CompanyName,
              lovCondition = (Request.QueryString["lovCondition"] ?? String.Empty)
          });}
        <div class="guess">
            <div class="guess_title">
                猜你喜欢</div>
            <div class="guess_box">
                @Html.Action("RecommendJobs")
            </div>
        </div>
    </div>
    <div class="main_content_right">
        <div class="main_content_findJob">
            <div class="main_content_findJob_title">
                找到
                @Model.SearchCount
                个职位</div>
            <div class="main_content_findJob_box">
                <ul>
                    @{
                        //工作年限
                        Html.RenderAction("JobLovInfo", new {
                            jobTitle = Model.JobTitle,
                            companyName = Model.CompanyName,
                            lovType = Forest.Cat.Domain.Shared.LovType.YearsOfExperience,
                            lovCondition = (Request.QueryString["lovCondition"] ?? String.Empty)
                        });
                        //发布日期
                        //Html.RenderAction("JobLovInfo", new { jobTitle = Model.JobTitle,companyName = Model.CompanyName, lovType = Forest.Cat.Domain.Shared.LovType.PostedDate });
                        //学历要求
                        Html.RenderAction("JobLovInfo", new {
                            jobTitle = Model.JobTitle,
                            companyName = Model.CompanyName,
                            lovType = Forest.Cat.Domain.Shared.LovType.EducationLevel,
                            lovCondition = (Request.QueryString["lovCondition"] ?? String.Empty)
                        });
                        //月薪范围
                        Html.RenderAction("JobLovInfo", new {
                            jobTitle = Model.JobTitle,
                            companyName = Model.CompanyName,
                            lovType = Forest.Cat.Domain.Shared.LovType.SalaryRange,
                            lovCondition = (Request.QueryString["lovCondition"] ?? String.Empty)
                        });
                        //公司性质
                        Html.RenderAction("JobLovInfo", new {
                            jobTitle = Model.JobTitle,
                            companyName = Model.CompanyName,
                            lovType = Forest.Cat.Domain.Shared.LovType.CompanyType,
                            lovCondition = (Request.QueryString["lovCondition"] ?? String.Empty)
                        });
                        //工作类型
                        Html.RenderAction("JobLovInfo", new {
                            jobTitle = Model.JobTitle,
                            companyName = Model.CompanyName,
                            lovType = Forest.Cat.Domain.Shared.LovType.JobType,
                            lovCondition = (Request.QueryString["lovCondition"] ?? String.Empty)
                        });
                    }
                    @*<li>
                            <h3>
                                发布日期：</h3>
                            <div class="totalMessages">
                                <a href="#" class="cur">所有 </a><a href="#">近一天（309）</a><a href="#">近两天（387）</a><a
                                    href="#">近三天（418）</a><a href="#">近一周（444）</a><a href="#">近两周（485）</a><a href="#">近一月（519）</a><a
                                        href="#">近六周（538）</a><a href="#">近两月（579）</a>
                            </div>
                            <div class="cl">
                            </div>
                        </li>
                        <li class="last">
                            <h3>
                                工作类型：</h3>
                            <div class="totalMessages">
                                <a href="#" class="cur">所有 </a><a href="#">全职（579）</a><a href="#">兼职（21）</a>
                            </div>
                            <div class="cl">
                            </div>
                        </li>*@
                </ul>
            </div>
        </div>
        <div class="main_content_updateMessages">
            <div class="update_title">
                <div class="sort">
                    排序：
                    <input id="orderByReposted" type="image" src="@(Model.OrderMode == JobListOrderMode.Reposted ? "/Themes/DarkOrange/Content/images/btn-loading-59-22.jpg" : "/Themes/DarkOrange/Content/images/blue_agxr.gif")" />
                    @Html.DropDownList("orderByStartDate", Model.StartDateConditionList)
                </div>
                <div class="jobMessage">
                    <span>共 @Model.SearchCount 个职位</span>
                </div>
            </div>
            <table cellpadding="0" cellspacing="0">
                @foreach (var job in Model.JobList) { 
                    <tr>
                        <td>
                            <div class="Job_detail">
                                <div class="Job_detail_text">
                                    <div class="Job_detail_textTop">
                                        <div class="jobName">
                                            @Html.ActionLink(job.JobTitle, "JobView", "Catalog", new { id = job.Id }, new { target = "_blank" })</div>
                                        <div class="jobCompany">
                                            @Html.ActionLink(job.CompanyModel.CompanyName, "CompanyView", "Company", new { id = job.CompanyModel.Id }, new { target = "_blank" })</div>
                                        <div class="job_time">
                                            @(Model.OrderMode == JobListOrderMode.Reposted ? job.Reposted.Value.ToString("yyyy-MM-dd") : job.StartDate.Value.ToString("yyyy-MM-dd"))</div>
                                        <div class="job_address">
                                            @job.CityName
                                            @(!String.IsNullOrWhiteSpace(job.DistrictName) ? " - " + job.DistrictName : String.Empty)</div>
                                        <div class="cl">
                                        </div>
                                    </div>
                                    <h5>
                                        @(job.EducationLevelName)@(String.IsNullOrWhiteSpace(job.EducationLevelName) ? String.Empty : "学历")
                                        @((String.IsNullOrWhiteSpace(job.EducationLevelName) || String.IsNullOrWhiteSpace(job.YearsOfExperienceName)) ? String.Empty : "，")
                                        @(job.YearsOfExperienceName)@(String.IsNullOrWhiteSpace(job.YearsOfExperienceName) ? String.Empty : "工作经验")</h5>
                                    <p>
                                        @Html.Raw(Forest.Core.Html.HtmlHelper.ConvertPlainTextToHtml(Html.SetDisplayTextLength(job.Responsibilities, 100)))</p>
                                </div>
                                <div class="Job_detail_btn" style="vertical-align: middle">
                                    <div class="btn_apply">
                                        @if (!job.IsApplied) {
                                            @Html.ActionLink("立即申请", "Apply", "JobApplication", new { id = job.Id, returnUrl = Request.Url.PathAndQuery }, new { @onclick = "return checkLogin();" })
                                        }
                                        else { 
                                            <a href="#">已申请</a>
                                        }
                                    </div>
                                    <p>
                                        @Html.Action("SavedJobView", "JobHunting", new { id = job.Id })</p>
                                </div>
                                <div class="cr">
                                </div>
                            </div>
                        </td>
                    </tr>
                }
            </table>
        </div>
        <div class="pager">
            @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
        </div>
    </div>
    <div class="cr">
    </div>
</div>
